package com.ccb.lms.service;

import java.sql.SQLException;
import java.util.List;

import com.ccb.lms.facade.FacadeDAO;
import com.ccb.lms.model.SystemAdmin;
import com.ccb.lms.util.BasePage;

/**
 * 
 * 
 * @author 吕婧
 *
 */

public class SystemAdminService implements ISystemAdminService {
	
	private FacadeDAO facadeDAO=null;



	public FacadeDAO getFacadeDAO() {
		return facadeDAO;
	}

	public void setFacadeDAO(FacadeDAO facadeDAO) {
		this.facadeDAO = facadeDAO;
	}

	public boolean deleteSystemAdmin(Integer systemAdminNO) {
		try {
			return facadeDAO.getSystemAdminDAO().deleteSystemAdmin(systemAdminNO);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return false;
	}

	public List<SystemAdmin> getAllSystemAdmin() {
		try {
			return facadeDAO.getSystemAdminDAO().getAllSystemAdmin();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}

	public SystemAdmin getSystemAdminByID(String systemAdminID) {
		try {
			return facadeDAO.getSystemAdminDAO().getSystemAdminByID(systemAdminID);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}

	public boolean insertSystemAdmin(SystemAdmin systemAdmin) {
		try {
			return facadeDAO.getSystemAdminDAO().insertSystemAdmin(systemAdmin);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return false;
	}



	public boolean updateSystemAdmin(SystemAdmin systemAdmin) {
		try {
			return facadeDAO.getSystemAdminDAO().updateSystemAdmin(systemAdmin);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return false;
	}

	public List<SystemAdmin> getSystemAdminByPage(BasePage basePage) {
		try {
			return facadeDAO.getSystemAdminDAO().getSystemAdminByPage(basePage);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}

	public int getSystemAdminCount() {
		try {
			return facadeDAO.getSystemAdminDAO().getSystemAdminCount();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return 0;
	}

	public BasePage getBasePage(int currentPage, int showRecordNum) {
		try {
			return facadeDAO.getSystemAdminDAO().getBasePage(currentPage, showRecordNum);
		} catch (SQLException e) {

			e.printStackTrace();
		}
		return null;
	}

	public boolean isLogin(SystemAdmin systemAdmin) {
		try {
			return facadeDAO.getSystemAdminDAO().isLogin(systemAdmin);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}
}

